/*******************************************************************************
 * Package: com.chris.order.api
 * Type:    ProductFeginFallBackFactory
 * Date:    2024/3/2 下午3:10
 *
 * Copyright (c) 2024 BOING CORP.,LTD All Rights Reserved.
 *
 * You may not use this file except in compliance with the License.
 *******************************************************************************/
package com.chris.order.api;

import com.chris.common.entity.Product;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * TODO your comment
 *
 * @author Hudesheng
 * @date 2024/3/2 下午3:10
 */
@Component
public class ProductFeginFallBackFactory implements FallbackFactory<ProductFegin> {
    @Override
    public ProductFegin create(Throwable throwable) {
        return new ProductFegin() {
            @Override
            public Product findByPid(Integer pid) {
                throwable.printStackTrace();
                Product product = new Product();
                product.setPid(-1);
                return product;
            }
        };
    }
}